<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
/*=================================================================*/
header("Cache-Control: no-store, no-cache, must-revalidate");	  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");															  // HTTP/1.0
?><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><?php
if($arrResult["WagerCon"] != ""){
	$arrResult["WagerCon"] = str_replace(chr(10), "", $arrResult["WagerTip"]."<br />".$arrResult["WagerCon"]);
	$arrResult["WagerCon"] = str_replace(chr(13), "", $arrResult["WagerCon"]);
	print "<script language=\"JavaScript\">\n<!--\n";
	print "parent.SuppleResult.innerHTML='".addslashes($arrResult["WagerCon"])."';\n";
	print "parent.open_SuppleResultWin();\n";
	print "//-->\n</script>\n";
	ob_end_flush();
	flush();
}

$isSpecial = intval($_data["isSpecial"]);
$isRealShow = intval($_data["isRealShow"]);
$intGID = intval($_data["GambleID"]);
if(strlen($_data["isSpecial"]) == 0)$isSpecial = 1;
if(strlen($_data["isRealShow"]) != 1)$isRealShow = 1;
$intSpecialNumType = intval($_data["SpecialNumType"]);
$strBT = trim($_data["Bet_Type"]);

$arrBType = split(",", $strBT);
if($intSpecialNumType > 0)$arrBType[] = 28;

for($i = 0; $i < sizeof($arrBType); $i++)include(__Common_Path."/todaygame/TodayGame".$intLottoID."_".$arrBType[$i].".inc.php");

if(!is_array($_arrTodayGame[$intGID])){
	$GLOBALS["errormessage"] = "No TodayGame Data!!";
	ErrMsgOutputHTML("Error", "", 1);
}
$_arrTodayGame = $_arrTodayGame[$intGID];

switch($arrPower[1]){
	case "all":
		$strSeach = " ";
		$strSeach2 = " ";
		$strMulti = ($isRealShow == 1)?"*(DirectorRate)":"";
		$strComm = ($isRealShow == 1)?"*DirectorCommission":"*0";
		$intSWType = 1;
		break;

	case "director":
		if($isRealShow == 2 && $_SESSION["Admin_Info"] -> isAllAccount == 1){	//公司總帳
			$strSeach = " ";
			$strSeach2 = " ";
			$strMulti = "*(DirectorRate)";
			$strComm = "*(DirectorCommission)";
		}else{
			$strSeach = " and DirectorID = ".$_SESSION["Admin_Info"] -> ID." ";
			$strSeach2 = " and b.DirectorID = ".$_SESSION["Admin_Info"] -> ID." ";
			$strMulti = ($isRealShow == 1)?"*(StockRate - DirectorRate)":"";
			$strComm = ($isRealShow == 1)?"*StockCommission":"*0";
		}
		$intSWType = 5;
		break;

	case "stock":
		/*if($isRealShow == 2 && $_SESSION["Admin_Info"] -> isAllAccount == 1){	//公司總帳
			$strSeach = " and DirectorID = ".$_SESSION["Admin_Info"] -> ID." ";
			$strMulti = "*(DirectorRate)";
			$strComm = "*(DirectorCommission)";
		}else{*/
			$strSeach = " and StockID = ".$_SESSION["Admin_Info"] -> ID." ";
			$strSeach2 = " and b.StockID = ".$_SESSION["Admin_Info"] -> ID." ";
			$strMulti = ($isRealShow == 1)?"*(MainRate - StockRate)":"";
			$strComm = ($isRealShow == 1)?"*MainCommission":"*0";
		//}
		$intSWType = 4;
		break;

	case "main":
		$strSeach = " and MainID = ".$_SESSION["Admin_Info"] -> ID." ";
		$strSeach2 = " and b.MainID = ".$_SESSION["Admin_Info"] -> ID." ";
		$strMulti = ($isRealShow == 1)?"*(SubRate - MainRate)":"";
		$strComm = ($isRealShow == 1)?"*SubCommission":"*0";
		$intSWType = 3;
		break;

	case "sub";
		$strSeach = " and SubID = ".$_SESSION["Admin_Info"] -> ID." ";
		$strSeach2 = " and b.SubID = ".$_SESSION["Admin_Info"] -> ID." ";
		$strMulti = ($isRealShow == 1)?"*(1 - SubRate)":"";
		$strComm = ($isRealShow == 1)?"*MemCommission":"*0";
		$intSWType = 2;
		break;
}

if($strBT == "7,8,9,10,11"){
	$strSQL = "select Bet_Type, '0' as Number, WagerType, Count(*) as total, sum(IF(WagerType = ".$intSWType.", MemStake,MemStake".$strMulti.")*MemExchangeRate) as betstatus, sum(IF(WagerType = ".$intSWType.",MemPayOff,MemPayOff".$strMulti.")*MemExchangeRate) as paystatus,  sum(IF(WagerType = ".$intSWType.",MemStake".$strComm.",MemStake".$strMulti.$strComm.")*MemExchangeRate) as commstatus from `bet_BetListTmp` where Bet_Type in (".join(",", $arrBType).") and GambleID = ".$intGID.$strSeach." and isPayOff >= 0 group by Bet_Type, WagerType";

}elseif(preg_match("/31|32|38/", $strBT)){ //五不中 生肖連 尾數連
	$strMulti= str_replace('_', 'b.', $strMulti);
	$strComm = str_replace('_', 'b.', $strComm);
	$strSQL = "select a.Bet_Type as Bet_Type, a.Number as Number, a.Ball1, a.Ball2, a.Ball3, a.Ball4, a.Ball5, b.WagerType, Count(*) as total, sum(IF(b.WagerType = ".$intSWType.",a.MemStake, a.MemStake".$strMulti.")*b.MemExchangeRate) as betstatus, sum(IF(WagerType = ".$intSWType.", a.MemPayOff, a.MemPayOff".$strMulti.")*b.MemExchangeRate) as paystatus,  sum(IF(WagerType = ".$intSWType.", a.MemStake, a.MemStake".$strMulti.")*b.MemExchangeRate".$strComm.") as commstatus  from `bet_ParlaysNumberEven` a, `bet_BetListTmp` b where a.BetListID = b.ID and b.GambleID = ".$intGID.$strSeach2." and  b.Bet_Type in (".$strBT.") and b.isPayOff >= 0 group by a.Bet_Type, a.Number, b.WagerType";

}else{
	$strSQL = "select Bet_Type, Number, WagerType, Count(*) as total, sum(IF(WagerType = ".$intSWType.", MemStake, MemStake".$strMulti.")*MemExchangeRate) as betstatus, sum(IF(WagerType = ".$intSWType.",MemPayOff,MemPayOff".$strMulti.")*MemExchangeRate) as paystatus,  sum(IF(WagerType = ".$intSWType.",MemStake".$strComm.",MemStake".$strMulti.$strComm.")*MemExchangeRate) as commstatus from `bet_BetListTmp` where Bet_Type in (".join(",", $arrBType).") and GambleID = ".$intGID.$strSeach." and isPayOff >= 0 group by Bet_Type, Number, WagerType";
}
//print $strSQL;
if(!$RS = PMA_mysql_query($strSQL, $$_Conn)){
	$GLOBALS["errormessage"] = "Find Wager Data Error!!";
	$GLOBALS["errorhidden"] = "Error: ".PMA_mysql_error($$_Conn)."\nSQL:".$strSQL."\nLine:".__LINE__."\nPage:".__FILE__;
	ErrMsgOutputHTML("Error", "", 1);
}

$arrGroupCounter = array(31 => 5, 32 => 2, 33 => 3, 34 => 4, 35 => 2, 36 => 3, 37 => 4, 38 => 2, 39 => 3, 40 => 4, 41 => 2, 42 => 3, 43 => 4);
while($Rows = PMA_mysql_fetch_object($RS)){
	$intBT = ($intSpecialNumType > 0 && ($Rows -> Bet_Type == 1 || $Rows -> Bet_Type == 28))?1:$Rows -> Bet_Type;
	if($Rows -> WagerType == $intSWType){
		if(preg_match("/31|32|33|34|35|36|37|38|39|40|41|42|43/", $intBT)){
			$intGroupCounter = $arrGroupCounter[$intBT];
			for($i = 1; $i <= $intGroupCounter; $i++){
				$strBall = "Ball".$i;
				$intNum = $Rows -> $strBall;
				$arrSpWCount[$intBT][$intNum] += $Rows -> total;// / $intGroupCounter;
				$arrSpWSum[$intBT][$intNum] += $Rows -> betstatus / $intGroupCounter;
				$arrSpPayOff[$intBT][$intNum] += $Rows -> paystatus / $intGroupCounter;
				$arrSpCommission[$intBT][$intNum] += $Rows -> commstatus / $intGroupCounter;
			}
		}else{
			$arrSpWCount[$intBT][$Rows -> Number] += $Rows -> total;
			$arrSpWSum[$intBT][$Rows -> Number] += $Rows -> betstatus;
			$arrSpPayOff[$intBT][$Rows -> Number] += $Rows -> paystatus;
			$arrSpCommission[$intBT][$Rows -> Number] += $Rows -> commstatus;
		}
	}else{
		if(preg_match("/31|32|33|34|35|36|37|38|39|40|41|42|43/", $intBT)){
			$intGroupCounter = $arrGroupCounter[$intBT];
			for($i = 1; $i <= $intGroupCounter; $i++){
				$strBall = "Ball".$i;
				$intNum = $Rows -> $strBall;
				$arrWCount[$intBT][$intNum] += $Rows -> total;// / $intGroupCounter;
				$arrWSum[$intBT][$intNum] += $Rows -> betstatus / $intGroupCounter;
				$arrPayOff[$intBT][$intNum] += $Rows -> paystatus / $intGroupCounter;
				$arrCommission[$intBT][$intNum] += $Rows -> commstatus / $intGroupCounter;
			}
		}else{
			$arrWCount[$intBT][$Rows -> Number] += $Rows -> total;
			$arrWSum[$intBT][$Rows -> Number] += $Rows -> betstatus;
			$arrPayOff[$intBT][$Rows -> Number] += $Rows -> paystatus;
			$arrCommission[$intBT][$Rows -> Number] += $Rows -> commstatus;
		}
	}
}

$intTmpBT = 0;
$sumStake = 0;
$sumPayOff = 0;
$sumCommission = 0;
$sumOUStake = 0;
$sumOUPayOff = 0;
$sumOUCommission = 0;
$sumOEStake = 0;
$sumOEPayOff = 0;
$sumOECommission = 0;
$sumSOEStake = 0;
$sumSOEPayOff = 0;
$sumSOECommission = 0;
$arrOE16Stake = array(0,0,0,0,0,0,0);
$arrOE16PayOff = array(0,0,0,0,0,0,0);
$arrOE16Commission = array(0,0,0,0,0,0,0);
$arrOU16Stake = array(0,0,0,0,0,0,0);
$arrOU16PayOff = array(0,0,0,0,0,0,0);
$arrOU16Commission = array(0,0,0,0,0,0,0);
$arrColor16Stake = array(0,0,0,0,0,0,0);
$arrColor16PayOff = array(0,0,0,0,0,0,0);
$arrColor16Commission = array(0,0,0,0,0,0,0);
$arrSuppleOE16Stake = array(0,0,0,0,0,0,0);
$arrSuppleOE16PayOff = array(0,0,0,0,0,0,0);
$arrSuppleOE16Commission = array(0,0,0,0,0,0,0);
$arrSuppleOU16Stake = array(0,0,0,0,0,0,0);
$arrSuppleOU16PayOff = array(0,0,0,0,0,0,0);
$arrSuppleOU16Commission = array(0,0,0,0,0,0,0);
$arrSuppleColor16Stake = array(0,0,0,0,0,0,0);
$arrSuppleColor16PayOff = array(0,0,0,0,0,0,0);
$arrSuppleColor16Commission = array(0,0,0,0,0,0,0);
$arrSOE16Stake = array(0,0,0,0,0,0,0);
$arrSOE16PayOff = array(0,0,0,0,0,0,0);
$arrSOE16Commission = array(0,0,0,0,0,0,0);
$arrSuppleSOU16Stake = array(0,0,0,0,0,0,0);
$arrSuppleSOU16PayOff = array(0,0,0,0,0,0,0);
$arrSuppleSOU16Commission = array(0,0,0,0,0,0,0);
$sumColorStake = 0;
$sumColorPayOff = 0;
$sumColorCommission = 0;
$sumAnimalsStake = 0;
$sumAnimalsPayOff = 0;
$sumAnimalsCommission = 0;
$arrHelfColorStake = array(0,0);
$arrHelfColorPayOff = array(0,0);
$arrHelfColorCommission = array(0,0);
$arrSuppleHelfColorStake = array(0,0);
$arrSuppleHelfColorPayOff = array(0,0);
$arrSuppleHelfColorCommission = array(0,0);
$arrSumStake = array();
$arrSumPayOff = array();
$arrSumCommission = array();
$arrSumSuppleStake = array();
$arrSumSupplePayOff = array();
$arrSumSuppleCommission = array();
reset($_arrTodayGame);

while(list($intBT, $arrN) = each($_arrTodayGame)){
	while(list($intNum, $Rows) = each($arrN)){
		$intSBT = ($intSpecialNumType > 0 && ($intBT == 1 || $intBT == 28))?1:$intBT;
		$intWCount = $arrWCount[$intSBT][$intNum]+0;
		$tolStake = $arrWSum[$intSBT][$intNum]+0;
		$tolPayOff = $arrPayOff[$intSBT][$intNum]+0;
		$tolCommission = $arrCommission[$intSBT][$intNum]+0;
		//補貨
		$intSpWCount = $arrSpWCount[$intSBT][$intNum]+0;
		$tolSuppleStake = $arrSpWSum[$intSBT][$intNum]+0;
		$tolSupplePayOff = $arrSpPayOff[$intSBT][$intNum]+0;
		$tolSuppleCommission = $arrSpCommission[$intSBT][$intNum]+0;

		/*$intDenominator = 1;
		if($intBT >= 31 && $intBT <= 43){
			switch($intBT){
				case 31:
					$intDenominator = 5;
					break;

				case 32:
				case 35:
				case 38:
				case 41:
					$intDenominator = 2;
					break;

				case 33:
				case 36:
				case 39:
				case 42:
					$intDenominator = 3;
					break;

				case 34:
				case 37:
				case 40:
				case 43:
					$intDenominator = 4;
					break;
			}
			$intWCount = $intWCount;
			$tolStake = $tolStake / $intDenominator;
			$tolPayOff = $tolPayOff / $intDenominator;
			$tolCommission = $tolCommission / $intDenominator;
			//補貨
			$intSpWCount = $intSpWCount;
			$tolSuppleStake = $tolSuppleStake / $intDenominator;
			$tolSupplePayOff = $tolSupplePayOff / $intDenominator;
			$tolSuppleCommission = $tolSuppleCommission / $intDenominator;
		}*/

		$intApointNum = $_arrGLineNumToApointNum[$Rows["LottoID"]][$Rows["Bet_Type"]][$Rows["Number"]];
		if($intApointNum == null)$intApointNum = 0;
		$flGLine = $_arrGambleType[$Rows["Bet_Type"]][$intApointNum];

		If($intBT == 1 || $intBT == 28){
			if(!(($intSpecialNumType == 1 && $intBT != 1) || ($intSpecialNumType == 2 && $intBT != 28)) && $intNum != 0){
				$strCon .= "parent.Game".$intSBT."[".$intNum."]=new Array('".$Rows["LottoID"]."','".$intGID."','".$Rows["Bet_Type"]."','".$Rows["Number"]."','".$Rows["OddsID"]."','".($Rows["Odds"]+$flGLine)."','".$Rows["isStopBet"]."','".$intWCount."','".$tolStake."','".$tolPayOff."','".$tolCommission."','".$intSpWCount."','".$tolSuppleStake."','".$tolSupplePayOff."','".$tolSuppleCommission."');\n";
			}
		}else{
			$strCon .= "parent.Game".$intBT."[".$intNum."]=new Array('".$Rows["LottoID"]."','".$intGID."','".$Rows["Bet_Type"]."','".$Rows["Number"]."','".$Rows["OddsID"]."','".($Rows["Odds"]+$flGLine)."','".$Rows["isStopBet"]."','".$intWCount."','".$tolStake."','".$tolPayOff."','".$tolCommission."','".$intSpWCount."','".$tolSuppleStake."','".$tolSupplePayOff."','".$tolSuppleCommission."');\n";
		}
		switch($intBT){
			case 1:
			case 4:
			case 21:
			case 22:
			case 23:
			case 24:
			case 25:
			case 26:
			//case 28:
				$sumStake += $tolStake;
				$sumPayOff += $tolPayOff;
				$sumCommission += $tolCommission;
				$sumSuppleStake += $tolSuppleStake;
				$sumSupplePayOff += $tolSupplePayOff;
				$sumSuppleCommission += $tolSuppleCommission;
				break;

			case 3:
			case 6:
				$sumOUStake += $tolStake;
				$sumOUPayOff += $tolPayOff;
				$sumOUCommission += $tolCommission;
				$sumSuppleOUStake += $tolSuppleStake;
				$sumSuppleOUPayOff += $tolSupplePayOff;
				$sumSuppleOUCommission += $tolSuppleCommission;
				break;

			case 16:
				$sumSOEStake += $tolStake;
				$sumSOEPayOff += $tolPayOff;
				$sumSOECommission += $tolCommission;
				$sumSuppleSOEStake += $tolSuppleStake;
				$sumSuppleSOEPayOff += $tolSupplePayOff;
				$sumSuppleSOECommission += $tolSuppleCommission;
				break;

			case 2:
			case 5:
				$sumOEStake += $tolStake;
				$sumOEPayOff += $tolPayOff;
				$sumOECommission += $tolCommission;
				$sumSuppleOEStake += $tolSuppleStake;
				$sumSuppleOEPayOff += $tolSupplePayOff;
				$sumSuppleOECommission += $tolSuppleCommission;
				break;

			case 12:
				$intNum = floor($intNum / 10);
				$arrOE16Stake[$intNum] += $tolStake;
				$arrOE16PayOff[$intNum] += $tolPayOff;
				$arrOE16Commission[$intNum] += $tolCommission;
				$arrSuppleOE16Stake[$intNum] += $tolSuppleStake;
				$arrSuppleOE16PayOff[$intNum] += $tolSupplePayOff;
				$arrSuppleOE16Commission[$intNum] += $tolSuppleCommission;
				break;

			case 13:
				$intNum = floor($intNum / 10);
				$arrOU16Stake[$intNum] += $tolStake;
				$arrOU16PayOff[$intNum] += $tolPayOff;
				$arrOU16Commission[$intNum] += $tolCommission;
				$arrSuppleOU16Stake[$intNum] += $tolSuppleStake;
				$arrSuppleOU16PayOff[$intNum] += $tolSupplePayOff;
				$arrSuppleOU16Commission[$intNum] += $tolSuppleCommission;
				break;

			case 14:
				$intNum = floor($intNum / 10);
				$arrColor16Stake[$intNum] += $tolStake;
				$arrColor16PayOff[$intNum] += $tolPayOff;
				$arrColor16Commission[$intNum] += $tolCommission;
				$arrSuppleColor16Stake[$intNum] += $tolSuppleStake;
				$arrSuppleColor16PayOff[$intNum] += $tolSupplePayOff;
				$arrSuppleColor16Commission[$intNum] += $tolSuppleCommission;
				break;

			case 17:
			case 20:
				$sumColorStake += $tolStake;
				$sumColorPayOff += $tolPayOff;
				$sumColorCommission += $tolCommission;
				$sumSuppleColorStake += $tolSuppleStake;
				$sumSuppleColorPayOff += $tolSupplePayOff;
				$sumSuppleColorCommission += $tolSuppleCommission;
				break;

			case 18:
			case 19:
				$sumAnimalsStake += $tolStake;
				$sumAnimalsPayOff += $tolPayOff;
				$sumAnimalsCommission += $tolCommission;
				$sumSuppleAnimalsStake += $tolSuppleStake;
				$sumSuppleAnimalsPayOff += $tolSupplePayOff;
				$sumSuppleAnimalsCommission += $tolSuppleCommission;
				break;

			case 27:
				$intNum = floor($Rows["Number"] / 10);
				$arrSOE16Stake[$intNum] += $intWSum;
				$arrSOE16PayOff[$intNum] += $intPayOff;
				$arrSOE16Commission[$intNum] += $intCommission;
				$arrSuppleSOE16Stake[$intN] += $tolSuppleStake;
				$arrSuppleSOE16PayOff[$intN] += $tolSupplePayOff;
				$arrSuppleSOE16Commission[$intN] += $tolSuppleCommission;
				break;

			case 29:
				$intN = floor(($intNum % 4) / 2);
				$arrHelfColorStake[$intN] += $tolStake;
				$arrHelfColorPayOff[$intN] += $tolPayOff;
				$arrHelfColorCommission[$intN] += $tolCommission;
				$arrSuppleHelfColorStake[$intN] += $tolSuppleStake;
				$arrSuppleHelfColorPayOff[$intN] += $tolSupplePayOff;
				$arrSuppleHelfColorCommission[$intN] += $tolSuppleCommission;
				break;

			default:
				$arrSumStake[$intBT] += $tolStake;
				$arrSumPayOff[$intBT] += $tolPayOff;
				$arrSumCommission[$intBT] += $tolCommission;
				$arrSumSuppleStake[$intBT] += $tolSuppleStake;
				$arrSumSupplePayOff[$intBT] += $tolSupplePayOff;
				$arrSumSuppleCommission[$intBT] += $tolSuppleCommission;
				break;
		} //switch($Rows -> Bet_Type)
	} //while(list($intNum, $Rows) = each($arrN))
} //while(list($intBT, $arrN) = each($_arrTodayGame))
/*=================================================================*/
//header("Cache-Control: no-store, no-cache, must-revalidate");	  // HTTP/1.1
//header("Cache-Control: post-check=0, pre-check=0", false);
//header("Pragma: no-cache");															  // HTTP/1.0
?>
<script language="JavaScript">
<!--
<?php 
print $strCon."\n";

foreach($arrSumStake as $intBT => $val){
	print "parent.arrSumStake[".$intBT."] = ".round($arrSumStake[$intBT]).";\n";
	print "parent.arrSumPayOff[".$intBT."] = ".round($arrSumPayOff[$intBT]).";\n";
	print "parent.arrSumCommission[".$intBT."] = ".round($arrSumCommission[$intBT]).";\n";
	print "parent.arrSumSuppleStake[".$intBT."] = ".round($arrSumSuppleStake[$intBT]).";\n";
	print "parent.arrSumSupplePayOff[".$intBT."] = ".round($arrSumSupplePayOff[$intBT]).";\n";
	print "parent.arrSumSuppleCommission[".$intBT."] = ".round($arrSumSuppleCommission[$intBT]).";\n";
}

switch($strBT){
	case "1":
	case "2":
	case "3":
	case "4":
	case "5":
	case "6":
	case "16":
	case "1,2,3,16":
	case "4,5,6":
		if(preg_match("/1|4/", $strBT)){
			print "parent.sumStake = ".round($sumStake).";\n";
			print "parent.sumPayOff = ".round($sumPayOff).";\n";
			print "parent.sumCommission = ".round($sumCommission).";\n";
			print "parent.sumSuppleStake = ".round($sumSuppleStake).";\n";
			print "parent.sumSupplePayOff = ".round($sumSupplePayOff).";\n";
			print "parent.sumSuppleCommission = ".round($sumSuppleCommission).";\n";
		}
		if(preg_match("/3|6/", $strBT)){
			print "parent.sumOUStake = ".round($sumOUStake).";\n";
			print "parent.sumOUPayOff = ".round($sumOUPayOff).";\n";
			print "parent.sumOUCommission = ".round($sumOUCommission).";\n";
			print "parent.sumSuppleOUStake = ".round($sumSuppleOUStake).";\n";
			print "parent.sumSuppleOUPayOff = ".round($sumSuppleOUPayOff).";\n";
			print "parent.sumSuppleOUCommission = ".round($sumSuppleOUCommission).";\n";
		}
		if(preg_match("/2|5/", $strBT)){
			print "parent.sumOEStake = ".round($sumOEStake).";\n";
			print "parent.sumOEPayOff = ".round($sumOEPayOff).";\n";
			print "parent.sumOECommission = ".round($sumOECommission).";\n";
			print "parent.sumSuppleOEStake = ".round($sumSuppleOEStake).";\n";
			print "parent.sumSuppleOEPayOff = ".round($sumSuppleOEPayOff).";\n";
			print "parent.sumSuppleOECommission = ".round($sumSuppleOECommission).";\n";
		}
		if(preg_match("/16/", $strBT)){
			print "parent.sumSOEStake = ".round($sumSOEStake).";\n";
			print "parent.sumSOEPayOff = ".round($sumSOEPayOff).";\n";
			print "parent.sumSOECommission = ".round($sumSOECommission).";\n";
			print "parent.sumSuppleSOEStake = ".round($sumSuppleSOEStake).";\n";
			print "parent.sumSuppleSOEPayOff = ".round($sumSuppleSOEPayOff).";\n";
			print "parent.sumSuppleSOECommission = ".round($sumSuppleSOECommission).";\n";
		}
		print "parent.ShowNumberOdds(".$isSpecial.");\n";
		break;

	case "7":
	case "8":
	case "9":
	case "10":
	case "11":
	case "7,8,9,10,11":
		//$arrSort = getJNSortData($intGID, 10, 1, $_SESSION["Admin_Info"] -> ID, $arrPower[1]);
		//foreach($arrSort as $intBT => $arrData){
		//	print "parent.arrJNSort[$intBT] = new Array('".join("', '", $arrData)."');\n";//
		//}
		print "parent.ShowJoinNumberOdds();\n";
		break;

	case "12":
	case "13":
	case "14":
	case "27":
	case "12,13,14,27":
		if(preg_match("/12/", $strBT)){
			print "parent.arrOE16Stake = new Array(".join(",", $arrOE16Stake).");\n";
			print "parent.arrOE16PayOff = new Array(".join(",", $arrOE16PayOff).");\n";
			print "parent.arrOE16Commission = new Array(".join(",", $arrOE16Commission).");\n";
			print "parent.arrSuppleOE16Stake = new Array(".join(",", $arrSuppleOE16Stake).");\n";
			print "parent.arrSuppleOE16PayOff = new Array(".join(",", $arrSuppleOE16PayOff).");\n";
			print "parent.arrSuppleOE16Commission = new Array(".join(",", $arrSuppleOE16Commission).");\n";
		}
		if(preg_match("/13/", $strBT)){
			print "parent.arrOU16Stake = new Array(".join(",", $arrOU16Stake).");\n";
			print "parent.arrOU16PayOff = new Array(".join(",", $arrOU16PayOff).");\n";
			print "parent.arrOU16Commission = new Array(".join(",", $arrOU16Commission).");\n";
			print "parent.arrSuppleOU16Stake = new Array(".join(",", $arrSuppleOU16Stake).");\n";
			print "parent.arrSuppleOU16PayOff = new Array(".join(",", $arrSuppleOU16PayOff).");\n";
			print "parent.arrSuppleOU16Commission = new Array(".join(",", $arrSuppleOU16Commission).");\n";
		}
		if(preg_match("/14/", $strBT)){
			print "parent.arrColor16Stake = new Array(".join(",", $arrColor16Stake).");\n";
			print "parent.arrColor16PayOff = new Array(".join(",", $arrColor16PayOff).");\n";
			print "parent.arrColor16Commission = new Array(".join(",", $arrColor16Commission).");\n";
			print "parent.arrSuppleColor16Stake = new Array(".join(",", $arrSuppleColor16Stake).");\n";
			print "parent.arrSuppleColor16PayOff = new Array(".join(",", $arrSuppleColor16PayOff).");\n";
			print "parent.arrSuppleColor16Commission = new Array(".join(",", $arrSuppleColor16Commission).");\n";
		}
		if(preg_match("/27/", $strBT)){
			print "parent.arrSOE16Stake = new Array(".join(",", $arrSOE16Stake).");\n";
			print "parent.arrSOE16PayOff = new Array(".join(",", $arrSOE16PayOff).");\n";
			print "parent.arrSOE16Commission = new Array(".join(",", $arrSOE16Commission).");\n";
			print "parent.arrSuppleSOU16Stake = new Array(".join(",", $arrSuppleSOU16Stake).");\n";
			print "parent.arrSuppleSOU16PayOff = new Array(".join(",", $arrSuppleSOU16PayOff).");\n";
			print "parent.arrSuppleSOU16Commission = new Array(".join(",", $arrSuppleSOU16Commission).");\n";
		}
		print "parent.ShowNormalNumber1_6Odds(0);\n";
		break;

	case "17":
	case "18":
	case "17,18":
		if(preg_match("/17/", $strBT)){
			print "parent.sumColorStake = ".round($sumColorStake).";\n";
			print "parent.sumColorPayOff = ".round($sumColorPayOff).";\n";
			print "parent.sumColorCommission = ".round($sumColorCommission).";\n";
			print "parent.sumSuppleColorStake = ".round($sumSuppleColorStake).";\n";
			print "parent.sumSuppleColorPayOff = ".round($sumSuppleColorPayOff).";\n";
			print "parent.sumSuppleColorCommission = ".round($sumSuppleColorCommission).";\n";
		}
		if(preg_match("/18/", $strBT)){
			print "parent.sumAnimalsStake = ".round($sumAnimalsStake).";\n";
			print "parent.sumAnimalsPayOff = ".round($sumAnimalsPayOff).";\n";
			print "parent.sumAnimalsCommission = ".round($sumAnimalsCommission).";\n";
			print "parent.sumSuppleAnimalsStake = ".round($sumSuppleAnimalsStake).";\n";
			print "parent.sumSuppleAnimalsPayOff = ".round($sumSuppleAnimalsPayOff).";\n";
			print "parent.sumSuppleAnimalsCommission = ".round($sumSuppleAnimalsCommission).";\n";
		}
		print "parent.ShowAnimalsColorOdds();\n";
		break;

	case "19":
	case "20":
	case "19,20":
		if(preg_match("/20/", $strBT)){
			print "parent.sumColorStake = ".round($sumColorStake).";\n";
			print "parent.sumColorPayOff = ".round($sumColorPayOff).";\n";
			print "parent.sumColorCommission = ".round($sumColorCommission).";\n";
			print "parent.sumSuppleColorStake = ".round($sumSuppleColorStake).";\n";
			print "parent.sumSuppleColorPayOff = ".round($sumSuppleColorPayOff).";\n";
			print "parent.sumSuppleColorCommission = ".round($sumSuppleColorCommission).";\n";
		}
		if(preg_match("/19/", $strBT)){
			print "parent.sumAnimalsStake = ".round($sumAnimalsStake).";\n";
			print "parent.sumAnimalsPayOff = ".round($sumAnimalsPayOff).";\n";
			print "parent.sumAnimalsCommission = ".round($sumAnimalsCommission).";\n";
			print "parent.sumSuppleAnimalsStake = ".round($sumSuppleAnimalsStake).";\n";
			print "parent.sumSuppleAnimalsPayOff = ".round($sumSuppleAnimalsPayOff).";\n";
			print "parent.sumSuppleAnimalsCommission = ".round($sumSuppleAnimalsCommission).";\n";
		}
		print "parent.ShowAnimalsMantissaOdds();\n";
		break;
	case "21":
	case "22":
	case "23":
	case "24":
	case "25":
	case "26":
		print "parent.sumStake = ".round($sumStake).";\n";
		print "parent.sumPayOff = ".round($sumPayOff).";\n";
		print "parent.sumCommission = ".round($sumCommission).";\n";
		print "parent.sumSuppleStake = ".round($sumSuppleStake).";\n";
		print "parent.sumSupplePayOff = ".round($sumSupplePayOff).";\n";
		print "parent.sumSuppleCommission = ".round($sumSuppleCommission).";\n";
		print "parent.ShowNumberOdds(".$isSpecial.");\n";
		break;
	case "29":
		print "parent.arrHelfColorStake = new Array(".join(",", $arrHelfColorStake).");\n";
		print "parent.arrHelfColorPayOff = new Array(".join(",", $arrHelfColorPayOff).");\n";
		print "parent.arrHelfColorCommission = new Array(".join(",", $arrHelfColorCommission).");\n";
		print "parent.arrSuppleHelfColorStake = new Array(".join(",", $arrSuppleHelfColorStake).");\n";
		print "parent.arrSuppleHelfColorPayOff = new Array(".join(",", $arrSuppleHelfColorPayOff).");\n";
		print "parent.arrSuppleHelfColorCommission = new Array(".join(",", $arrSuppleHelfColorCommission).");\n";
		print "parent.ShowHelfColorOdds();\n";
		break;

	case "31":
		print "parent.ShowFiveNotWinNumber();\n";
		break;

	case "32":
	case "33":
	case "34":
	case "35":
	case "36":
	case "37":
	case "32,33,34,35,36,37":
		print "parent.ShowBT3243Number(32);\n";
		break;

	case "38":
	case "39":
	case "40":
	case "41":
	case "42":
	case "43":
	case "38,39,40,41,42,43":
		print "parent.ShowBT3243Number(38);\n";
		break;
}

/*if($arrResult["WagerCon"] != ""){
	$arrResult["WagerCon"] = str_replace(chr(10), "", $arrResult["WagerTip"]."<br />".$arrResult["WagerCon"]);
	$arrResult["WagerCon"] = str_replace(chr(13), "", $arrResult["WagerCon"]);
	print "parent.SuppleResult.innerHTML='".addslashes($arrResult["WagerCon"])."';\n";
	print "parent.open_SuppleResultWin();\n";
}*/
?>
//-->
</script>